import allure
from appium.webdriver.common.appiumby import AppiumBy

from base.xueqiu_app import XueQiu
from page.result_page import ResultPage


class SearchPage(XueQiu):
    # def __init__(self, driver: WebDriver):
    #     self.driver = driver
    _input_text = AppiumBy.ID, 'com.xueqiu.android:id/search_input_text'
    _search_button = AppiumBy.ID, "com.xueqiu.android:id/tv_text"

    @allure.step('搜索页')
    def search_pages(self, send_key):
        # 搜索页，输入文本
        self.find_ele_key(self._input_text, send_key)
        # 点击搜索
        self.find_ele_click(self._search_button)
        return ResultPage(self.driver)
